import {createRouter, createWebHistory,createWebHashHistory} from 'vue-router'
import Layout from '@/laout/index'
import shouye from "@/views/shouye/index";
import login from "@/views/login/login";

const routes = [

  {
    path: '/',
    name: 'layout',
    redirect:'/index',
    component: () => import(/* webpackChunkName: "about" */ '../laout/index.vue'),
    children:[
      {
        path: 'index',
        component: shouye
      }
    ]
  },
  {
    path: '/login',
    component:login,

  },
]

const constantRoutes = createRouter({
  // history: createWebHashHistory(),
  // history: createWebHistory(process.env.BASE_URL),
  history: createWebHistory(),
  routes
})
export const loadView = (view) => { // 路由懒加载
  return () => import(`@/views/${view}`);
  // return (resolve) => require([`@/views/${view}`], resolve)
}
export default constantRoutes

